import { createApp } from 'vue'
import App from './App'
import store from './store'
import router from './router'

// unocss
import '@unocss/reset/tailwind-compat.css'

import 'virtual:uno.css'

import '@/assets/styles/index.scss' // global css
import 'element-plus/theme-chalk/src/message.scss'
import 'element-plus/theme-chalk/src/message-box.scss'
import directive from './directive' // directive
// 注册指令
import plugins from './plugins' // plugins
import { download } from '@/utils/request'

// svg图标
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/SvgIcon'
import elementIcons from '@/components/SvgIcon/svgicon'

import Message from 'vue-m-message'
import 'vue-m-message/dist/style.css'

import './permission' // permission control

import { useDict } from '@/utils/dict'
import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'

import useVxeTable from '@/plugins/vxetable.js'

const app = createApp(App)

// 全局方法挂载
app.config.globalProperties.useDict = useDict
app.config.globalProperties.download = download
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels

app.use(router)
app.use(store)
app.use(plugins)
app.use(elementIcons)
app.use(useVxeTable)
app.use(Message)
app.component('svg-icon', SvgIcon)

directive(app)

app.mount('#app')
